package com.mjk.common.core.jdbc.service.plus.mapper;


import com.mjk.common.base.model.BaseEntity;
import com.mjk.common.core.jdbc.service.plus.provider.impl.wrap.WrapSQLProvider;
import com.mjk.common.core.jdbc.service.plus.wrap.BeeComplexQueryWrapper;
import com.mjk.common.core.jdbc.service.plus.wrap.BeeQueryWrapper;
import org.apache.ibatis.annotations.*;

import java.util.List;
import java.util.Map;

@Mapper
public interface WrapMapper<T extends BaseEntity> {

    @SelectProvider(type= WrapSQLProvider.class, method="complexSelectByWrapp")
    @ResultType(Map.class)
    List<Map<String,Object>> complexSelectByWrapp(@Param("wrap") BeeComplexQueryWrapper warpper);

    @SelectProvider(type = WrapSQLProvider.class, method = "complexSelectByWrappWithPage")
    @ResultType(Map.class)
    List<Map<String, Object>> complexSelectByWrappWithPage(@Param("wrap") BeeComplexQueryWrapper warpper);

    @SelectProvider(type= WrapSQLProvider.class, method="selectByExample")
    @ResultType(Map.class)
    List<Map<String,Object>> selectByExample(@Param("wrap") BeeQueryWrapper warpper);

    @SelectProvider(type= WrapSQLProvider.class, method="countByExample")
    Long selectByExample_COUNT(@Param("wrap") BeeQueryWrapper warpper);

    @SelectProvider(type=WrapSQLProvider.class, method="selectByPrimaryKey")
    List<Map<String,Object>> selectByPrimaryKey(@Param("dto") BaseEntity paramBaseEntity);

    @SelectProvider(type= WrapSQLProvider.class, method="excuteSql")
    List<Map<String,Object>> excuteSelectSql(String paramString);

    @SelectProvider(type = WrapSQLProvider.class, method = "countByExample")
    Integer countByExample(@Param("wrap") BeeQueryWrapper warpper);

    @DeleteProvider(type = WrapSQLProvider.class, method = "deleteByExample")
    Integer deleteByExample(@Param("wrap") BeeQueryWrapper warpper);

    @InsertProvider(type = WrapSQLProvider.class, method = "insert")
    Integer insertSelective(@Param("item") T paramT);

    @InsertProvider(type = WrapSQLProvider.class, method = "insert")
    @Options(useGeneratedKeys=true,keyProperty = "id",keyColumn = "id")
    Integer insertSelectivewithId(@Param("item") T paramT);

    @DeleteProvider(type = WrapSQLProvider.class, method = "deleteByPrimaryKey")
    Integer deleteByPrimaryKey(T paramT);

    @UpdateProvider(type = WrapSQLProvider.class, method = "updateByExampleSelective")
    Integer updateByExampleSelective(@Param("wrap") BeeQueryWrapper warpper);

    @UpdateProvider(type = WrapSQLProvider.class, method = "updateByPrimaryKeySelective")
    Integer updateByPrimaryKeySelective(@Param("dto") T paramT);

    @SelectProvider(type = WrapSQLProvider.class, method = "excuteSql")
    List<Map<String,Object>> excuteSql(Map<String, Object> paramString);

    @InsertProvider(type = WrapSQLProvider.class, method = "insertBaseList")
    Integer insertList(@Param("list") List<T> paramList);

    @DeleteProvider(type = WrapSQLProvider.class, method = "deleteBaseList")
    Integer deleteList(@Param("list") List<T> paramList);

    @UpdateProvider(type = WrapSQLProvider.class, method = "updateBaseList")
    Integer updateList(@Param("list") List<T> paramList);

}
